<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<title>详情</title>
	<meta name="format-detection" content="telephone=no" />
	<link rel="stylesheet" type="text/css" href="../css/api.css" />
	<link rel="stylesheet" type="text/css" href="../css/common.css" />
	<link rel="stylesheet" type="text/css" href="../css/aui.css" />
	<style>
		html,
		body {
			width: 100%;
			min-height: 100%;
			background-color: #f4f4f4;
		}

		#header {
			background-color: #f4f4f4;
			width: 100%;
			text-align: left;
			height: auto;
			border-bottom: 1px solid #bebfbf;
			margin-top: 10px;
		}

		#header #listtitle {
			width: 90%;
			margin: 0px 5% 20px 5%;
			font-size: 1.3em;
			font-weight: bold;
		}

		#header .info {
			width: 90%;
			margin: 10px 5%;
		}

		.info {
			margin-top: 9px;
			/* margin-bottom: 11px;*/
			color: #666;
			font-size: 0.9em;
			position: relative;
			line-height: 15px;
			display: box;
			display: -webkit-box;
			height: 15px;
		}

		.info #from {
			font-size: 1em;
			color: #666;
			display: block;
			margin-top: 1px;
		}

		.info #date {
			color: #666;
			font-size: 1em;
			line-height: 15px;
			margin-right: 5px;
			margin-top: 1px;
			position: absolute;
			right: 0;
		}

		#main {
			line-height: 26px;
			margin: 0px 5%;
			font-size: 1.1em;
			width: 90%;
		}

		#main em {
			font-size: 1.2em;
			font-weight: bold;
			line-height: 32px;
		}

		#url {
			word-break: break-all;
			color: #19B4FF;
		}

		#footer {
			height: 100px;
			background: #ffffff;
		}

		#content {
			width: 100%;
			word-break: break-all;
		}

		#content p {
			margin-top: 0;
			margin-bottom: 0;
			font-size: 1.1em;
			color: rgb(50, 50, 50);
		}
		img {
			max-width: 100%;
			height: auto;
			margin-left: auto;
			margin-right: auto;
		}
	</style>
</head>

<body>
	<div id="header">
		<div id="listtitle"></div>
		<div class="info">
			<span id="from"></span>
			<span id="date"></span>
		</div>
	</div>
	<div id="main">
		<!-- <div id="div_chuzhibaogao" style="display: none;margin-top: 20px;">
			<em>处置报告:</em>
			<ul id='ul_imgList' style="background-color: #f4f4f4;" class="aui-list-view aui-grid-view">

			</ul>
		</div> -->
		<div class="main_url" style="margin-top: 20px;">
			<em>链接:</em>
			<span id="url"></span>
		</div>
		<!-- <div class="description" style="margin-top: 20px;">
     		<em>摘要：</em>
       		<div id="description"></div>
   		</div> -->
		<div class="content" style="margin-top: 20px;">
			<em>正文:</em>
			<div id="content"></div>
		</div>
		<div class="remarks" style="margin-top: 20px;">
			<em>备注:</em>
			<div id="remarks"></div>
		</div>
		<!-- <div class="contact" style="margin-top: 20px;">
			<em>大众舆情业务联系人：</em>
			<div id="contact"></div>
		</div> -->
	</div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/alpenlicebe.js"></script>
<script type="text/javascript" src="../script/zepto.min.js"></script>
<script type="text/javascript" src="../script/hashes.min.js"></script>
<script>
	function goto_AddImageFun_show(imgUrl) {
		var obj = api.require('imageBrowser');
		obj.openImages({
			imageUrls: [imgUrl],
			showList: false,
			activeIndex: 0
		});
	}
	apiready = function() {
		/*加载详细*/
		goto_loadInfoDetailFun();

		/*如果用户处理了，进行刷新*/
		api.addEventListener({
			name: 'Alpe_Event_yq_dosomething'
		}, function(ret) {
			if (ret) {
				goto_loadInfoDetailFun();
			}
		});
		/*注册监听事件-用户登录*/
		api.addEventListener({
			name: 'Alpe_Event_UserLogin'
		}, function(ret) {
			if (ret) {
				goto_loadInfoDetailFun();
			}
		});
	}

	function goto_loadInfoDetailFun() {
		var infoID = api.pageParam.infoID;
		var is_button = api.pageParam.is_button;

		if ('' == infoID || undefined == infoID || null == infoID) {
			api.alert({
				title: '系统提示',
				msg: '参数错误'
			});
			return;
		}
		api.showProgress({
			style: 'default',
			animationType: 'fade',
			title: '',
			text: '',
			modal: false
		});

		var MD5 = new Hashes.MD5;
		var access_token = Alpe_getLocalStorge("access_token");
		var admin_id = Alpe_getLocalStorge("admin_id");
		var sign = MD5.hex(access_token + admin_id + infoID + 'datas/getMsg1.0syjqingbao');

		var url = Alpe_ApiUrl + 'r=datas/getMsg&access_token=' + access_token + '&admin_id=' + admin_id +
			'&message_id=' + infoID + '&isShowBtn=' + is_button
			'&v=1.0&sign=' + sign;
		console.log(url);
		api.ajax({
			url: url,
			method: 'get',
			cache: false,
			timeout: 30,
			dataType: 'json'
		}, function(ret, err) {
			if (ret) {
				if (ret.success == '100') {
					$("#listtitle").html(ret.title);
					$("#from").html(ret.media_name);
					$("#date").html(ret.send_time);
					$("#url").html('<div onclick="goto_openOldNewsWinFun(\'' + ret.url + '\')" tapmode="presshover" style="color:blue">' + ret.url + '</div>');
					$("#content").html(ret.content);
					$("#description").html(ret.abstract_content);
					$("#remarks").html(ret.bak);
					$("#contact").html('<a href="tel:' + ret.tel + '" style="color:blue">' + ret.qb_tel + '</a>');

					/*api.sendEvent({
					    name: 'Alpe_Event_NewsDetailContent',
					    extra:{
						    keyID:'alpenlicebe',
						    news:ret,
						}
					});*/
					//console.log($api.jsonToStr(ret.img_path));
					if (ret.deal_status == 2) {
						if (ret.img_path.length > 0) {
							$("#div_chuzhibaogao").show();
						}
						$.each(ret.img_path, function(index, v) {
							var html = "<li class='aui-list-view-cell aui-img aui-col-xs-4' style='position: relative;text-align: center;margin: 0 auto'>" +
								"<img style='height:100px' class='aui-img-object' src='" + v.pic_path + "'> " +
								"<div style='text-align: center; padding-top: 5px; position: absolute;z-index: 999;top: 60px; left: 10px; bottom: 0; right: 0;'>" +
								"<button onclick=goto_AddImageFun_show('" + v.pic_path + "'); style='width:90%;' class='aui-btn aui-btn-primary'>点击查看</button>" +
								"</div>" +
								"</li>";
							$("#ul_imgList").append(html);
						});
					}
					$('#content a').each(function() {
						var href = $(this).attr("href");
						$(this).attr("onclick", "goto_openOldNewsWinFun('" + href + "')");
						$(this).attr("href", "#");　　
					});
					api.sendEvent({
						name: 'Alpe_Event_NewsDetailContent',
						extra: {
							keyID: 'alpenlicebe',
							news: ret,
						}
					});
					// goto_loadInfoDetailFun_forShortUrl();
					//goto_openBottomMenuFun(ret.title,ret.abstract_content,ret.url,ret.is_collect,ret.is_pass,ret.pass_status,ret.deal_status,ret.is_deal,ret.forwarding_status);
				} else if ("002" == ret.success || "003" == ret.success) {
					goto_openWin_loginWin(ret.message);
				} else {
					api.toast({
						msg: ret.message,
						duration: 2000,
						location: 'middle'
					});
				}
				api.hideProgress();
			} else {
				api.alert({
					title: '系统提示',
					msg: '获取信息出现错误，请返回重试'
				});
				api.hideProgress();
			}
		});
	}
	function goto_openOldNewsWinFun(url) {
		api.openWin({
			name: 'WebView',
			url: 'webView.html',
			pageParam: {
				weburl: url
			}

		});
	}
	function goto_loadInfoDetailFun_forShortUrl() {
		var infoID = api.pageParam.infoID;
		if ('' == infoID || undefined == infoID || null == infoID) {
			api.alert({
				title: '系统提示',
				msg: '参数错误'
			});
			return;
		}
		api.showProgress({
			style: 'default',
			animationType: 'fade',
			title: '',
			text: '',
			modal: false
		});

		var MD5 = new Hashes.MD5;
		var access_token = Alpe_getLocalStorge("access_token");
		var admin_id = Alpe_getLocalStorge("admin_id");
		var sign = MD5.hex(access_token + admin_id + '1' + infoID + 'datas/getMsg1.0syjqingbao');

		var url = Alpe_ApiUrl + 'r=datas/getMsg&access_token=' + access_token + '&admin_id=' + admin_id +
			'&is_short_url=1&message_id=' + infoID +
			'&v=1.0&sign=' + sign;
		api.ajax({
			url: url,
			method: 'get',
			cache: false,
			timeout: 30,
			dataType: 'json'
		}, function(ret, err) {
			if (ret) {
				if (ret.success == '100') {
					api.sendEvent({
						name: 'Alpe_Event_NewsDetailContent',
						extra: {
							keyID: 'alpenlicebe',
							news: ret,
						}
					});
				} else if ("002" == ret.success || "003" == ret.success) {
					goto_openWin_loginWin(ret.message);
				} else {
					api.toast({
						msg: ret.message,
						duration: 2000,
						location: 'middle'
					});
				}
				api.hideProgress();
			} else {
				api.alert({
					title: '系统提示',
					msg: '获取短链接出现错误，请返回重试。'
				});
				api.closeWin();
				api.hideProgress();
			}
		});
	}

	function goto_openPhoneBrowerFun(url) {
		if ('ios' == api.systemType) {
			api.openApp({
				iosUrl: url
			}, function(ret, err) {

			});
		}
		if ('android' == api.systemType) {
			api.openApp({
				androidPkg: 'android.intent.action.VIEW',

				uri: url
			}, function(ret, err) {});
		}
	}
</script>

</html>
